package com.example.mapper;

import com.example.entity.ClubImage;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClubImageMapper {
    @Select("SELECT ci.*, s.name as uploaderName FROM club_image ci " +
            "LEFT JOIN student s ON ci.uploader_id = s.id " +
            "WHERE ci.club_id = #{clubId} ORDER BY ci.upload_time DESC")
    List<ClubImage> selectByClubId(Integer clubId);

    @Insert("INSERT INTO club_image (club_id, image_url, uploader_id) VALUES (#{clubId}, #{imageUrl}, #{uploaderId})")
    int insert(ClubImage image);

    @Delete("DELETE FROM club_image WHERE id = #{id}")
    int deleteById(Integer id);
} 